From: Florian Müllner Date: Mon, 7 Jun 2021 15:49:57 +0000 (+0200) Subject: status/network: Disable modem connection when windows aren't allowed X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~574^2^2~205 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=25793b9d9759dd5e75e6aa4ffc069ebe1ea4af09;p=gnome-shell.git status/network: Disable modem connection when windows aren't allowed The item launches the corresponding Settings panel when activated, which doesn't work when windows are disabled by the session mode. Rather than failing silently, turn the item insensitive. Part-of: --- diff --git a/js/ui/status/network.js b/js/ui/status/network.js index 5487fde40..6e7878d20 100644 --- a/js/ui/status/network.js +++ b/js/ui/status/network.js @@ -563,6 +563,10 @@ var NMDeviceModem = class extends NMConnectionDevice { this._iconChanged(); }); } + + this._sessionUpdatedId = + Main.sessionMode.connect('updated', this._sessionUpdated.bind(this)); + this._sessionUpdated(); } get category() { @@ -573,6 +577,10 @@ var NMDeviceModem = class extends NMConnectionDevice { launchSettingsPanel('network', 'connect-3g', this._device.get_path()); } + _sessionUpdated() { + this._autoConnectItem.sensitive = Main.sessionMode.hasWindows; + } + destroy() { if (this._operatorNameId) { this._mobileDevice.disconnect(this._operatorNameId); @@ -582,6 +590,10 @@ var NMDeviceModem = class extends NMConnectionDevice { this._mobileDevice.disconnect(this._signalQualityId); this._signalQualityId = 0; } + if (this._sessionUpdatedId) { + Main.sessionMode.disconnect(this._sessionUpdatedId); + this._sessionUpdatedId = 0; + } super.destroy(); }